﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Registro.Compras.Api.Models;
using Registro.Compras.Data.Business;
using Registro.Compras.Data.Entities;
using System.Web.Http.Cors;

namespace Registro.Compras.Api.Controllers
{
    [EnableCors(origins: "*", headers: "*", methods: "*")]
    public class Tabla2Controller : ApiController
    {

        public IEnumerable<Tabla2Model> Get()
        {

            return Tabla2Business.GetListByFilter("").Select(
                t => new Tabla2Model
                {
                    Id = t.Id,
                    Descripcion = t.Descripcion,
                });
        }


        public Tabla2Model Get(int id)
        {
            Tabla2 t = Tabla2Business.GetById(id);
            return new Tabla2Model
            {
                Id = t.Id,
                Descripcion = t.Descripcion,
            };
        }

    }
}